package com.tongtong.stscommon.exception.controller;

import com.tongtong.stscommon.enumration.Message;
import com.tongtong.stscommon.enumration.Status;
import com.tongtong.stscommon.exception.STSAuthenticationException;
import com.tongtong.stscommon.exception.STSException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Jwt异常转发器
 */
@RestController
public class JwtExceptionController {

	@RequestMapping("/illegalJwtException")
	public void illegalJwtException(HttpServletRequest request) throws STSException {
		throw new STSAuthenticationException(Status.AuthenticationError, Message.TokenIllegal);
	}

	@RequestMapping("/expiredJwtException")
	public void expiredJwtException(HttpServletRequest request) throws STSException {
		throw new STSAuthenticationException(Status.AuthenticationError, Message.TokenExpired);
	}

}
